<script type="text/javascript">
    $(document).ready(function() {
        $("#dialog_view").tabs();

        $("#dialog_view").dialog({
            autoOpen: false,
            height: 500,
            width: 800,
            position: ['top', 'middle'],
            resizable: false,
            modal: true
        });

        $(".button-edit").click(function() {
            var id_item = $(this).attr("lang");
            $.get("{$config->site_url('laporan/barang/view_nilaiaset/" + id_item + "')}", function(data) {
                $("#content").html(data);
            });
            $("#dialog_view").dialog('open')
        });
    });
</script> 
<div class="breadcrum">
    <p>
        <a href="{$config->site_url('laporan/barang')}">Reporting</a>
        <span></span>
        <a href="{$config->site_url('laporan/barang/nilaiaset')}">Barang</a>
        <span></span>
        <small>{$rs_detail.kategoribarang_name|default:''}</small>
    </p>
    <div class="clear"></div>
</div>
<div class="search-box">
    <h3><a href="#">Search</a></h3>
    <form method="post" action="{$config->site_url('laporan/barang/proses_filter/'|cat:$rs_detail.kategoribarang_cd)}">
        <table width="100%" border="0" class="table-search">
            <tbody>
                <tr>
                    <th width="12%">Jenis Barang</th>
                    <td width="15%">
                        <select style="width: 200px;" name="jenisbarang_cd" id="jenisbarang_cd">
                            <option value=""></option>
                            {foreach from=$rs_jenis item=data}
                            <option value="{$data.jenisbarang_cd|default:''}" {if {$search.jenisbarang_cd|default:''} eq $data.jenisbarang_cd}selected="selected"{/if}>{$data.jenisbarang_name}</option>
                            {/foreach}
                        </select>
                    </td>
                    <th width="12%">Merk Barang</th>
                    <td width="15%">
                        <select  style="width: 200px;" name="merk_cd" id="merk_cd">
                            <option value=""></option>
                            {foreach from=$rs_merk item=data}
                            <option value="{$data.merk_cd|default:''}" {if {$search.merk_cd|default:''} eq $data.merk_cd}selected="selected"{/if}>{$data.merk_name}</option>
                            {/foreach}
                        </select>
                    </td>
                    <th width="11%">Ruang</th>
                    <td width="15%">
                        <select style="width: 200px;" name="ruang_cd" id="ruang_cd">
                            <option value=""></option>
                            {foreach from=$rs_ruang item=data}
                            <option value="{$data.ruang_cd|default:''}" {if {$search.ruang_cd|default:''} eq $data.ruang_cd}selected="selected"{/if}>{$data.ruang_name}</option>
                            {/foreach}
                        </select>
                    </td>
                    <th width="20%">
                        <input type="submit" value="Tampilkan" name="save" class="submit">
                        <input type="submit" value="Reset" name="save" class="submit">
                    </th>
                </tr>
            </tbody>
        </table>
    </form>
</div>
<div class="sub-content">   
    <!-- notification template -->
    {include file="base/templates/notification.html"}
    <!-- end of notification template--> 
    <div class="navigation">
        <div class="pageRow">
            <div class="pageNav">
                <ul>
                    <li class="info"><strong>{$pagination.start|default:'0'} - {$pagination.end|default:'0'}</strong> dari <strong>{$pagination.total|default:'0'}</strong> Data</li>
                    {$pagination.data|default:''}
                </ul>
            </div>
            <div class="clear"></div>
        </div>
        <div class="navigation-button">
            <ul>
                <li><a href="{$config->site_url('laporan/barang/nilaiaset_excel/'|cat:$rs_detail.kategoribarang_cd|default:'')}"><img alt="" src="{$BASEURL}/resource/doc/images/icon/printer-icon.png">Print Data</a></li> 
            </ul>
            <div class="clear"></div>
        </div>
    </div>
    <table width="100%" class="table-view">
        <tbody>
            <tr>
                <th width="5%">No</th> 
                <th width="13%">No Inventaris</th> 
                <th width="20%">Nama Barang</th> 
                <th width="10%">Ruang</th>
                <th width="20%">Nilai Perolehan</th>
                <th width="20%">Nilai Buku</th>
                <th width="12%">Histori Penyusutan</th>
            </tr>
            {$no = 1}
            {foreach from=$rs_id item=result}
            <tr {if ($no % 2) <> 0}class="blink-row"{/if}>
                <td align="center">{$no++}</td>
                <td>{$result.barang_noinventaris|default:''}</td>
                <td>{$result.barang_nama|default:''}</td>
                <td align="center">{$result.ruang_name|default:''}</td>
                <td align="right">{$result.barang_harga_beli|number_format:0:",":"."|default:'0'}</td>
                <td align="right">{$result.barang_nilai_buku|number_format:0:",":"."|default:'0'}</td>
                <td align="center">
                    <a href="#" class="button-edit" lang="{$result.barang_id|default:''}">Histori</a>
                </td>
            </tr>
            {foreachelse}
            <tr>
                <td colspan="7">Data masih kosong</td>
            </tr>
            {/foreach}
        </tbody>
    </table> 
</div>
<div id="dialog_view" display="none" title="Histori Penyusutan"> 
    <div class="sub-content" id="content"> 
    </div>
</div>